using System.IO;
using System.IO.Ports;
using com.tc.config;
using com.tc.gateway.tunnel;
using com.tc.gateway.serial;
namespace com.tc.serial
{


    public class SerialFactory
    {
        static SerialStream stream;
        static void create()
        {

            if (WorkingConfig.mainController)
            {

                stream = new WinSerialStream("COM3");
            }
            else
            {
                //				if(WorkingConfig.getInstance().getServerIp() != null)
                stream = TunnelManager.getClient(WorkingConfig.getInstance().getServerIp(), WorkingConfig.getInstance().getPort());
            }


        }
        public static SerialStream getStream()
        {
            if (stream == null)
                create();
            return stream;
        }

    }
}